import service from '@/utils/request'

export function getDepartment() {
  return service({
    url: '/company/department'

  })
}
export function delDepartment(id) {
  return service({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

export function getDepartmentByID(id) {
  return service({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
// export function addDepartment(data) {
//   return service({
//     url: `/company/department`,
//     method: 'post',
//     data
//   })
// }
// 新增组织架构接口
export function addDepartments({ code, introduce, manager, name, pid }) {
  return service({
    url: '/company/department',
    method: 'post',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}
// 修改
export function editDepartments({ code, introduce, manager, name, pid, id }) {
  return service({
    url: `/company/department/${id}`,
    method: 'put',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}
